﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace NSX07
{
    public partial class SiteManager : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Authenticate"].ToString() == "Yes")
            {
                lblUsername.Text = "Hello " + Session["User"].ToString() + "(You are in " + Session["Role"].ToString() + " role )";
                lblUsername.Visible = true;
                lnbtnLogout.Visible = true;
                hlRegister.Visible = false;
                hlLogin.Visible = false;

                if (Session["Role"].ToString().Trim() == "admin")
                {
                    manaPCtrl.Visible = true;
                    manaCCtrl.Visible = true;
                }
                else
                {
                    manaPCtrl.Visible = false;
                    manaCCtrl.Visible = false;
                    Response.Redirect("default.aspx");
                }
            }
            else
            {
                lblUsername.Visible = false;
                lnbtnLogout.Visible = false;
                hlRegister.Visible = true;
                hlLogin.Visible = true;
                Response.Redirect("default.aspx");
            }

            // end login//

           
        }

        protected void lnbtnLogout_Click(object sender, EventArgs e)
        {
            Session["Authenticate"] = "";
            Session["User"] = "";
            Session["Role"] = "";

            Response.Redirect("~/default.aspx");
        }

    }
}